package com.wudl.ums.config;

import com.wudl.log.event.SysLogListener;
import com.wudl.ums.service.LogService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：wudl
 * @date ：Created in 2022-01-23 1:13
 * @description：
 * @modified By：
 * @version: 1.0
 */

@Configuration
public class LogAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public SysLogListener sysLogListener(LogService logService){
        SysLogListener sysLogListener = new SysLogListener((optLogDTO) -> logService.saveLog(optLogDTO));
        return sysLogListener;
    }
}